var createGetUrl=function (url,data){
    var str='';
    var d;
    for(var i in data){
        if(str.length!==0){
            str = str+"&";
        }
        d = data[i];
        if((typeof d) === 'Array'){
            for(var j=0;j<d.length;j++){
                if(j>0) str+="&";
                str=str+i+"="+d[j];
            }
        }else{
            str=str+i+"="+data[i];
        }
    }
    var index;
    if ((index = url.indexOf("?")) > -1) {//原生url可能有参数保留原来的参数，这里不对参数做去重处理
        var param = url.substring(index + 1);
        var turl = url.substring(0, index + 1); //?保留
        if (turl.indexOf("=") > -1) { //如果?前有=说明该url可能有问题，所以不对url做处理
            param = undefined;
        } else {
            url = turl;
        }
    } else {
        url += "?";
    }
    if (param) url += param;
    url+=(url.indexOf("?")===url.length-1?"":"&")+encodeURI(str);
    return url;
}

var getGetUrlParam = function(url){
    var paramStr = decodeURI(url.substring(url.indexOf("?")+1));
    var param={};
    var ps = paramStr.split("&");
    if(ps){
        ps.forEach(function(p){
            var pin = p.split("=");
            var key = pin[0];
            var value = pin[1];
            var pm = param[key];
            if(pm === undefined){
                param[key]=value;
            }else{
                if((typeof pm) === 'Array'){
                    pm.push(value);
                }else{
                    pm = [pm,value];
                    param[key] = pm;
                }
            }
        });
    }
    return param;
}

function htmlEncode(html) {
    var temp = document.createElement("div");
    (temp.textContent != null) ? (temp.textContent = html) : (temp.innerText = html);
    var output = temp.innerHTML;
    temp = null;
    return output;
}

function htmlDecode(text) {
    var temp = document.createElement("div");
    temp.innerHTML = text;
    var output = temp.innerText || temp.textContent;
    temp = null;
    return output;
}